package com.cn.wanxi.servlet;

import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.model.NavModel;
import com.cn.wanxi.service.CompanyService;
import com.cn.wanxi.service.NavService;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

class CompanyAndNavServlet {

    static void setCompanyAndNavData(HttpServletRequest req) {
        CompanyService companyService = new CompanyService();
        CompanyModel companyModel = companyService.getCompanyModel();
        //        null  companyModel  区别？
//      companyModel=  null 表示对象为空
//    companyModel=     new CompanyModel();对象里面的值为null
        req.setAttribute("companyModel", companyModel);
//        req.setAttribute("logo", "028-9999999");
//        req.setAttribute("phone", "028-9999999");//key-value的形式经常存储

//        返回导航数据
        List<NavModel> navModelList = new ArrayList<>();
        NavService navService = new NavService();
        navModelList = navService.getNavModelList();
        req.setAttribute("navModelList", navModelList);
    }
}
